# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python


class Recipe(recipe.Recipe):
    name = 'libpng'
    version = '1.6.26'
    stype = SourceType.TARBALL
    url = 'http://download.sourceforge.net/libpng/libpng-1.6.26.tar.xz'
    licenses = [License.LibPNG]
    deps = ['zlib']
    patches = ['0001-neon-fix-function-export-names-for-iOS-armv7.patch']

    files_libs = ['libpng16']
    files_devel = ['include/libpng16', 'bin/libpng16-config',
                   'lib/pkgconfig/libpng16.pc', 'lib/pkgconfig/libpng.pc']

    def prepare(self):
        if self.config.target_platform == Platform.IOS:
            if 'GAS' in os.environ:
                self.new_env = {'CCAS': os.environ['GAS']}
                self.new_env['CCAS'] += ' -no-integrated-as '
        if self.config.target_arch == Architecture.ARM64:
            self.configure_options += ' --disable-arm-neon '
